Abnormality detection apparatus of comparator

ABSTRACT

Abnormality of a comparator is to be detected while it is assembled in a control apparatus. An output OUT of a comparator  4  is connected to a first analog data input port  13  in addition to an input port  11  of a microcomputer  6 . A pin P 1  as a signal input terminal of the comparator is connected to a second output port  15  capable of outputting an H or L microcomputer signal MO of the microcomputer and also to a second analog data input port  14 . An abnormality judgment portion  9  of the microcomputer can detect abnormality due to failure of the comparator itself and failure of the peripheral devices on the basis of the output of the comparator during a normal operation, the comparator output when the microcomputer signal is outputted, and the comparator outputs before and after the output and stop of the microcomputer signal.

BACKGROUND OF THE INVENTION

[0001] 1. Field of the Invention

[0002] This invention relates to an abnormality detection apparatus of a comparator in a control circuit equipped with a microcomputer.

[0003] 2. Description of Related Art

[0004] A comparator has been widely used in various input systems to a microcomputer in a control circuit equipped with the microcomputer. For example, the comparator compares voltages of signals from an input circuit that are inputted to two input terminals, and sends a comparison result as an H or L level output from an output terminal to an input port of the microcomputer.

[0005] Such a comparator includes a large number of terminal pins at its input/output terminals in addition to terminals of a driving power source system, and involves the possibility of open-circuit failure or short-circuit failure between the comparator main body and the terminal pin and failure in peripheral devices. Such failure in and around the comparator becomes an error input to the microcomputer and hinders normal control.

[0006] It is therefore necessary to confirm whether or not circuits in and around the comparator normally operate. Though a technology has been practiced in the past that takes out the comparator single body and confirms its basic operation, it has been difficult to confirm the comparator operation under the state where the comparator is used inside the control apparatus. When hysteresis is imparted to the comparator, means has not been available for detecting failure of the peripheral devices for imparting hysteresis.

SUMMARY OF THE INVENTION

[0007] In view of the problems described above, the invention aims at providing an abnormality detection apparatus of a comparator that can easily detect failure of the comparator while it is connected to a microcomputer of a control apparatus, and further an abnormality detection apparatus that can detect abnormality resulting from failure of peripheral devices in the case where they are used to impart hysteresis.

[0008] To accomplish the object, a first aspect according to the invention is that in which a comparator including an output terminal thereof connected to an input port of a microcomputer, wherein the output terminal of the comparator is further connected to a first analog data input port of the microcomputer, and the microcomputer includes an abnormality judgment portion for judging existence/absence of abnormality of the comparator on the basis of an output voltage of the comparator.

[0009] A second aspect according to the invention is that in which a signal input terminal of the comparator is further connected to an output port of the microcomputer capable of outputting a microcomputer signal of an H level or an L level relative to a reference voltage of the comparator, and the abnormality judgment portion judges existence/absence of abnormality of the comparator on the basis of an output level corresponding to the microcomputer signal and an output voltage of the comparator.

[0010] A third aspect according to the invention is that in which, in a comparator equipped with peripheral devices for imparting hysteresis and having an output terminal thereof connected to an input port of a microcomputer, an output terminal of the comparator is further connected to a first analog data input port of the microcomputer, a signal input terminal of the comparator is further connected to an output port of the microcomputer capable of outputting a microcomputer signal of an H level or an L level relative to a reference voltage of the comparator and also to a second analog data input port, and the microcomputer includes an abnormality judgment portion for judging existence/absence of abnormality of a comparator circuit inclusive of the peripheral devices on the basis of an output level corresponding to the microcomputer signal and an output voltage of the comparator and an input voltage of the comparator.

BRIEF DESCRIPTION OF THE DRAWINGS

[0011]FIG. 1 shows an embodiment of the invention;

[0012]FIG. 2 shows failure modes and their influences;

[0013]FIG. 3 shows a failure detection method; and

[0014]FIG. 4 is a flowchart that shows a flow of a diagnosis process.

DESCRIPTION OF PREFERRED EMBODIMENTS

[0015] An embodiment of the invention will be hereinafter explained.

[0016]FIG. 1 shows a construction of the embodiment.

[0017] A comparator circuit including a comparator 4 and peripheral devices 1 to 3 is interposed between an input circuit 5 and a microcomputer 6.

[0018] The comparator 4 has its pin P4 connected to a power source Vcc and its pin 5 connected to GND (ground) as its driving power source system. The comparator 4 includes a pin P1 of a non-inversion input and a pin P2 of an inversion input as its signal input terminals, and a pin P3 as an output terminal.

[0019] The pin P1 is connected to the input circuit 5 through the peripheral device 2 and the pin P2 is connected to the input circuit 5 through the peripheral device 1. The pin P3 is connected to an input port 11 of a microcomputer 6.

[0020] The input circuit 5 outputs reference potential, for example, to the pin P2 and a control signal the potential of which changes to the pin P1. It will be hereby assumed that the input to the pin P1 is IN+, the input to the pin P2 is IN− and the output from the pin P3 is OUT.

[0021] The peripheral device 3 is connected between the pin P3 and the pin P1. Each of the peripheral devices 1, 2 and 3 is a resistor, for example, and the peripheral devices 2 and 3 decide predetermined hysteresis. The peripheral device 1 is for matching impedance of an input path to the pin P2 with impedance of an input path of the pin P1 in which the peripheral device 2 is disposed.

[0022] The microcomputer 6 executes a logical process in accordance with a level (H/L) of the comparator output OUT applied to its input port 11 during a normal operation, and outputs a control signal from a first output port 12 to an external apparatus not shown in the drawing.

[0023] In this embodiment, the pin P3 of the comparator 4 is connected to a first analog data (AD) input port 13 of the microcomputer 6. The pin P1 is connected to a second output port 15 of the microcomputer 6 and to a second analog data input port 14.

[0024] The microcomputer 6 includes an OUT voltage detection portion 7 for detecting a voltage of the first analog data input port 13 (that is, the voltage of the comparator output OUT), an IN+ voltage detection portion 8 for detecting a voltage of the second analog data input port 14 (that is, the voltage of the comparator input IN+) and an abnormality judgment portion 9 to which the OUT voltage detection portion 7 and the IN+ voltage detection portion 8 are connected.

[0025] The abnormality judgment portion 9 is further connected to the input port 11 and to a second output port 15.

[0026] The abnormality judgment portion 9 normally keeps the second output port 15 open to achieve high impedance and changes the output of the second output port 15 (hereinafter called “microcomputer output”) MO to the H and L levels only at the time of predetermined diagnosis. Whether or not the function of the comparator 4 inclusive of the peripheral devices 1 to 3 is normal or abnormal is judged by detecting the state of each input port 11, 13, 14 through the OUT voltage detection portion 7, the IN+ voltage detection portion 8, etc, and by detecting normally the voltage of the pin P1 when the output level of the comparator 4 changes, through the IN+ voltage detection portion 8.

[0027] The OUT voltage detection portion 7, the IN+ voltage detection portion 8 and the failure judgment portion 9 are constituted by software.

[0028]FIG. 2 shows failure modes that may occur in and around the comparator, and their influences.

[0029] When the peripheral device 1 undergoes open (Open) failure due to disconnection, the comparator output OUT is fixed to H irrespective of the voltage value of the comparator input IN+. On the other hand, when the peripheral device 1 is short-circuited (Short), no influence is exerted.

[0030] When the peripheral device 2 undergoes open failure, the comparator output OUT is fixed. When the peripheral device 1 is short-circuited (Short), hysteresis decreases.

[0031] When the peripheral device 3 undergoes open failure, hysteresis decreases. When the peripheral device 3 is short-circuited, the comparator output OUT is fixed.

[0032] As to the comparator 4 per se, the comparator output OUT is fixed to L when the pin P1 related with the comparator input IN+ undergoes open failure.

[0033] When the pin P1 is short-circuited to the power source Vcc (Vcc Short), the comparator output OUT is fixed to H. When the pin P1 is short-circuited to GND (GND Short), the comparator output OUT is fixed to L.

[0034] When the pin P1 is short-circuited to the adjacent pin P2 (P2 Short), the comparator output OUT is fixed to L, too.

[0035] When the pin P2 related with the comparator input IN− undergoes open failure, the comparator output OUT is fixed to H.

[0036] When the pin P2 is short-circuited to the power source Vcc, the comparator output OUT is fixed to L.

[0037] When the pin P2 is short-circuited to GND, the comparator output OUT is fixed to H.

[0038] When the pin P2 is short-circuited to the pin P4 (P4 Short), the comparator output OUT is fixed to L, too.

[0039] When the pin P3 related with the comparator output OUT undergoes open failure, the comparator output OUT is fixed to an intermediate potential.

[0040] When the pin P3 is short-circuited to the power source Vcc, the comparator output OUT is fixed to H.

[0041] When the pin P3 is short-circuited to GND, the comparator output OUT is fixed to L.

[0042] When the pin P3 is short-circuited to the pin P5 (P5 Short), the comparator output OUT is fixed to H.

[0043] When the pin P4 connected to the power source Vcc undergoes open failure, the comparator output OUT is fixed to an intermediate potential.

[0044] On the other hand, when the pin P4 is short-circuited to the power source Vcc, no influence is exerted at all.

[0045] When the pin P4 is short-circuited to GND, supply of the power source becomes impossible.

[0046] When the pin P4 is short-circuited to the pin P1 (P1 Short), the comparator output OUT is fixed to H.

[0047] When the pin P5 connected to GND undergoes open failure, the comparator output OUT drops only to the intermediate potential.

[0048] When the pin P5 is short-circuited to the power source Vcc, supply of the power source becomes impossible.

[0049] When the pin P5 is short-circuited to GND, no influence is exerted at all.

[0050] When the pin P5 is short-circuited to the pin P3 (P3 Short), the comparator output OUT is fixed to H.

[0051] The influences of the failures described above are divided into several types, and can be classified as the detection codes in the following way:

[0052] Detection Code {circle over (1)}:

[0053] Comparator output OUT stops at intermediate potential.

[0054] Detection Code {circle over (2)}:

[0055] Comparator output OUT is fixed to H or L.

[0056] Detection Code {circle over (3)}:

[0057] Even when comparator output OUT once changes due to change of comparator input, it is thereafter fixed.

[0058] Detection Code {circle over (4)}:

[0059] Hysteresis changes.

[0060] Detection Code {circle over (5)}:

[0061] Supply of power source becomes impossible.

[0062] The abnormality judgment portion 9 of the microcomputer 6 confirms the existence/absence of each of these detection codes as shown in FIG. 3 to judge normality/abnormality.

[0063] In other words, as to the detection code {circle over (1)}, the voltage of the comparator output OUT is checked, and the comparator is judged as normal when the OUT voltage is higher than 4.75 V or lower than 0.5 V, and as being failed when the OUT voltage is higher than 0.5 V and lower than 4.75 V.

[0064] As to the detection code {circle over (2)}, the level of the output of the second output port 15 (microcomputer output) MO is changed, and the voltage of the comparator output OUT is checked.

[0065] The comparator is judged as normal when the microcomputer output MO is H and the OUT voltage is higher than 4.75 V, or when the microcomputer output MO is L and the OUT voltage is lower than 0.5 V. The comparator is judged as being failed when the microcomputer output MO is H and the OUT voltage is lower than 4.75 V, or when the microcomputer output MO is L and the OUT voltage is higher than 0.5 V.

[0066] As to the detection code {circle over (3)}, the levels of the comparator outputs OUT before and after the comparator diagnosis interposing the output of the microcomputer output MO is checked.

[0067] The comparator is judged as normal if no difference exists in the level (H or L) of the comparator output OUT before the microcomputer output MO is outputted to the second output port 15 and after the H or L microcomputer output MO is outputted and then the second output port 15 is again opened. The comparator is judged as being failed if such a difference exists.

[0068] As to the detection code {circle over (4)}, the voltage value of the comparator input IN+ is checked for each level change of the comparator output OUT.

[0069] The comparator is judged as normal when the difference between the IN+ voltage value of the comparator input when the level of the comparator output OUT changes from H to L and the IN+ voltage value when the level of OUT subsequently changes from L to H remains within a predetermined value. When the difference of both voltage values is greater than the predetermined value, hysteresis has changed, and comparator is judged being failed.

[0070] Incidentally, the change sequence between H and L of the level of the comparator output OUT may be H to L, or vice versa.

[0071] As to the detection code {circle over (5)}, the microcomputer output MO is changed to check the level of the comparator output OUT.

[0072] The comparator is judged as normal when the microcomputer output MO is H and the comparator output OUT is H, or when the microcomputer output MO is L and the comparator output OUT is L, and as being failed when the microcomputer output MO is H and the comparator output OUT is L or when the microcomputer output MO is L and the comparator output OUT is H.

[0073] Among the judgment standards described above, confirmation of the detection code {circle over (1)} and the detection code {circle over (4)} is executed by detecting the OUT voltage and the IN+ voltage value in an arbitrary interval while the ordinary use state of the comparator 6 is maintained.

[0074] Confirmation of the detection code {circle over (2)}, the detection code {circle over (3)} and the detection code {circle over (5)} is executed by outputting the microcomputer output MO from the abnormality judgment portion 9 to the second output port 15 by an interrupt process.

[0075]FIG. 4 is a flowchart showing an example of the flow of the diagnosis process in the microcomputer 6 for the detection code {circle over (2)}, the detection code {circle over (3)} and the detection code {circle over (5)}.

[0076] When an interrupt command of the start of diagnosis is given, the failure judgment portion 9 first stores the level (H or L) of the comparator output OUT inputted to the input port 11 in Step 101.

[0077] In subsequent Step 102, the abnormality judgment portion 9 outputs the microcomputer output MO of the H level to the second output port 15 and checks in Step 103 whether or not the comparator output OUT inputted to the input port 11 is H.

[0078] When the comparator output OUT is H, the flow proceeds to Step 104. The voltage value of the comparator output OUT is read from the OUT voltage detection portion 7, and whether or not the OUT voltage is higher than 4.75 V is checked.

[0079] When the OUT voltage is higher than 4.75 V, the microcomputer output MO to the second output port 15 is set this time to L in Step 105. In Step 106, whether or not the comparator output OUT is L is checked.

[0080] When the comparator output OUT is L, the flow proceeds to Step 107, and whether or not the OUT voltage is lower than 0.5 V is checked. When the OUT voltage is lower than 0.5 V, the flow proceeds to Step 108.

[0081] In Step 108, the second output port 15 is opened, and the output of the microcomputer MO is stopped.

[0082] In Step 109, the level of the comparator output OUT at the input port 11 is read. In Step 110, whether or not the level of the comparator output OUT before outputting of the microcomputer output MO, that is stored in the preceding Step 101, is coincident with the level of the comparator output OUT after the stop of the microcomputer output MO read in the preceding Step is checked.

[0083] When the levels of the comparator outputs OUT before and after outputting of the microcomputer output MO are the same, the comparator is judged as “normal” in Step 111 and the diagnosis is completed.

[0084] On the other hand, when the comparator output OUT is not H by the check in Step 103, when the OUT voltage is not higher than 4.75 V by the check in Step 104, when the comparator output OUT is not L by the check in Step 106, when the OUT voltage is not lower than 0.5 V by the check in Step 107 or when the levels of both comparator outputs OUT do not coincide by the check in Step 110, the comparator is judged as “being failed” in Step 112 and a report of failure is outputted to outside, whenever necessary. At the same time, internal setting is changed in Step 113 lest this comparator output OUT is used for the logical process inside the computer. The diagnosis is then completed.

[0085] Steps 101, 109 and 110 in the flow described above constitute failure detection about the detection code {circle over (3)}, Steps 102, 103, 105 and 106 constitute failure detection about the detection code {circle over (5)}, and Steps 102, 104, 105 and 107 constitute failure detection about the detection code {circle over (2)}.

[0086] When the comparator is judged as “being failed” in the diagnosis about other detection code {circle over (1)} and detection code {circle over (4)}, too, report of failure is similarly outputted to outside and internal setting is changed lest the comparator output OUT is used for the logical process inside the microcomputer.

[0087] The embodiment has the construction described above. In the comparator circuit inclusive of the peripheral devices for deciding hysteresis, the pin P3 of the comparator 4 is connected to the first analog data input port 13 of the microcomputer 6 and the pin P1 is connected to the second output port 15 and the second analog data input port 14 of the microcomputer 6 so that the voltage of the comparator output OUT and the voltage of the comparator input IN+ can be detected and the microcomputer output MO can be inputted to the comparator. Therefore, failure of the comparator 4 inclusive of failure of the intermediate potential and abnormality of the comparator circuit resulting from failure of the peripheral devices can be detected while the comparator circuit is kept assembled in the control apparatus.

[0088] As described above, in the invention, the output terminal of the comparator is connected to the first analog data input port in addition to the ordinary input port of the microcomputer, and the abnormality judgment portion provided to the microcomputer judges the existence/absence of abnormality of the comparator on the basis of the output voltage of the comparator. It is therefore possible to detect, for example, abnormality resulting from failure of the terminals of the power source system of the comparator or failure of the output terminal by detecting the state where the output voltage remains at the intermediate potential.

[0089] The signal input terminal of the comparator is further connected to the output port of the microcomputer that can output the H level or L level microcomputer signal relative to the reference voltage of the comparator. Consequently, abnormality resulting from open-circuit failure and short-circuit failure of each terminal of the comparator can also be detected by detecting the state where the comparator output is fixed at H or L when the microcomputer signal is outputted. Particularly, abnormality brought forth by failure of the supply of the power source resulting from short-circuit between the power source system terminals of the comparator can be detected by detecting the state where the comparator output does not correspond to H or L of the microcomputer signal when the microcomputer signal is outputted.

[0090] When the peripheral devices are additionally provided so as to impart hysteresis to the comparator, the output terminal of the comparator is connected also to the first analog data input port besides the ordinary input port of the microcomputer, and the signal input terminal of the comparator is connected to the output port of the microcomputer capable of outputting the H or L microcomputer signal relative to the reference voltage of the comparator and further to the second analog data input port. Therefore, abnormality resulting from failure of the peripheral devices can be detected, in addition to each of the failures described above, by detecting the change of hysteresis for each level change of the comparator output or by detecting the state where H or L of the comparator outputs before and after the stop of the output of the microcomputer signal do not coincide but are fixed at the opposite levels. 

What is claimed is:
 1. An abnormality detection apparatus for a comparator including an output terminal thereof connected to an input port of a microcomputer, which is characterized in that said output terminal of said comparator is further connected to a first analog data input port of said microcomputer, and said microcomputer includes an abnormality judgment portion for judging existence/absence of abnormality of said comparator on the basis of an output voltage of said comparator.
 2. An abnormality detection apparatus for a comparator as defined in claim 1, which is characterized in that a signal input terminal of said comparator is further connected to an output port of said microcomputer capable of outputting a microcomputer signal of an H level or an L level relative to a reference voltage of said comparator, and said abnormality judgment portion judges existence/absence of abnormality of said comparator on the basis of an output level corresponding to said microcomputer signal and an output voltage of said comparator.
 3. An abnormality detection apparatus for a comparator including peripheral devices for imparting hysteresis and an output terminal thereof connected to an input port of a microcomputer, which is characterized in that said output terminal of said comparator is further connected to a first analog data input port of said microcomputer, a signal input terminal of said comparator is further connected to an output port of said microcomputer capable of outputting a microcomputer signal of an H level or an L level relative to a reference voltage of said comparator and to a second analog data input port, and said microcomputer includes an abnormality judgment portion for judging existence/absence of abnormality of a comparator circuit inclusive of said peripheral devices on the basis of an output level corresponding to said microcomputer signal and an output voltage of said comparator and an input voltage of said comparator. 